class Pedal2 extends eui.Component implements  eui.UIComponent {
	public constructor(hero) {
		super()
		this.skinName="Ped";
		this.hero = hero;
        // this.addEventListener(egret.Event.ADDED_TO_STAGE,this.creatPedal,this)
	}


	public  mutiao//木条
	private pedGroup 
	private PedalGroup 
	private goods1 
	private goods2 
	private goods3
	private rock
	public hit:boolean = false
	public hero
	
	protected childrenCreated():void
	{	
		super.childrenCreated();

		this.hitHero(this.hero)
		this.creatPedal()
	}
	public  creatPedal(){
		var goodsRan1 = Math.floor(Math.random()*7)
		var goodsRan2 = Math.floor(Math.random()*3)
		let Arr = [this.goods1,this.goods2,this.goods3]
		var goodsArr = ["goods1_png","goods1_png","goods2_png","goods3_png","goods4_png","goods5_png","goods6_png",]
		Arr[goodsRan2].source = goodsArr[goodsRan1]
		this.rock.source = ("rock_png")
		this.x = 1136;
		//随机生成一个木条的y
		this.y = Math.floor(Math.random()*300)
		 


		this.addEventListener(egret.Event.ENTER_FRAME,function(){
			this.x-=12
		},this)
	}

	private hitHero(hero){
		if(!hero){return};
		this.addEventListener(egret.Event.ENTER_FRAME,function(){
			let res = Utils.hitTest(hero,this.mutiao);
			if(res){
				console.log("碰撞结果",res)
			}
			// if(this.x < -this.mutiao.width ){
			// 	if( this && this.$parent.contains(this)){
			// 		this.$parent.removeChild(this)
			// 	}
			// }
		},this)

	}
}